package cn.edu.neusoft.yuejian_02.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

import cn.edu.neusoft.yuejian_02.clas.Constants;
import es.dmoral.toasty.Toasty;

public class MainActivity extends BaseActivity {

    private SharedPreferences preferences;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);


       // Toast.makeText(this,getUser_id() , Toast.LENGTH_SHORT).show();
        if (getUser_id().equals("-1")){
           Intent intent = new Intent(MainActivity.this,LoginActivity.class);
            startActivity(intent);
        }else {
           getUserInfo();
            Toasty.success(MainActivity.this, Constants.USER_NICKNAME).show();
            Intent intent = new Intent(MainActivity.this,HomeActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);

            startActivity(intent);
        }


    }






}
